Mariadb及phpmyadmin的安装及配置(Centos 7) 您所在的位置:网站首页 mariadb 密码 Mariadb及phpmyadmin的安装及配置(Centos 7)

Mariadb及phpmyadmin的安装及配置(Centos 7)

2023-06-06 10:50| 来源: 网络整理| 查看: 265

CentOS 6 或早期的版本中提供的是 MySQL 的服务器/客户端安装包,但 CentOS 7 已使用了 MariaDB 替代了默认的 MySQL。MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

全部删除MySQL/MariaDB

MySQL 已经不再包含在 CentOS 7 的源中,而改用了 MariaDB;

1.使用rpm -qa | grep mariadb搜索 MariaDB 现有的包

[root@localhost ~]# rpm -qa | grep mariadb mariadb-libs-5.5.60-1.el7_5.x86_64 mariadb-server-5.5.60-1.el7_5.x86_64 mariadb-5.5.60-1.el7_5.x86_64 [root@localhost ~]#

在这里插入图片描述 如果存在,使用yum remove mysql mysql-server mysql-libs compat-mysql51全部删除

[root@localhost ~]# yum remove mysql mysql-server mysql-libs compat-mysql51 Loaded plugins: fastestmirror, langpacks No Match for argument: mysql-server No Match for argument: compat-mysql51 Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.60-1.el7_5 will be erased --> Processing Dependency: mariadb(x86-64) = 1:5.5.60-1.el7_5 for package: 1:mariadb-serv ......(省略) Removed: mariadb.x86_64 1:5.5.60-1.el7_5 mariadb-libs.x86_64 1:5.5.60-1.el7_5 Dependency Removed: mariadb-server.x86_64 1:5.5.60-1.el7_5 perl-DBD-MySQL.x86_64 0:4.023-6.el7 php-mysql.x86_64 0:5.4.16-46.el7 phpMyAdmin.noarch 0:4.4.15.10-3.el7 postfix.x86_64 2:2.10.1-6.el7 Complete! [root@localhost ~]#

在这里插入图片描述 再次搜索,已全部删除。

[root@localhost ~]# rpm -qa | grep mariadb [root@localhost ~]#

3.mariadb安装前准备:配置yum源:

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo(阿里云yum源)

[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2523 100 2523 0 0 13676 0 --:--:-- --:--:-- --:--:-- 13711 [root@localhost ~]#

4. 进入/etc/yum.repos.d/目录下,编辑 epel.repo 文件

[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# cat epel.repo [epel] name=epel baseurl=https://mirrors.aliyun.com/epel/7Server/x86_64/ gpgcheck=0 [root@localhost yum.repos.d]#

5. 安装mariadb 和 masriadb-server

[root@localhost ~]# yum install -y mariadb masriadb-server Loaded plugins: fastestmirror, langpacks base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com ......(省略) Installed: mariadb.x86_64 1:5.5.60-1.el7_5 Dependency Installed: mariadb-libs.x86_64 1:5.5.60-1.el7_5 Complete! [root@localhost ~]#

6. 启动服务

[root@localhost ~]# systemctl start mariadb [root@localhost ~]# systemctl enable mariadb

7. 对mariadb进行安全配置 :mariadb_secure_installation

设置 MariaDB 的 root 账户密码,删除匿名用户,禁用 root 远程登录,删除测试数据库,重新加载权限表。

[root@localhost ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. # 首先是设置密码,会提示先输入密码 Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] y


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有